<style lang="scss" scoped>
	.content {
		width: 100%;
		background-color: white;
		
		padding:30rpx 25rpx;
	}
	.line{
		height:80rpx;
		font-size: 28rpx;
	}
	
</style>

<template>
	<view class="content">
		<view class="f34 bold" style="padding:0 30rpx;border-bottom: 1px solid #eee;padding-bottom: 20rpx;">投票</view>
		<view class="f28 bold m-top30">{{temp.title}}</view>
		<view class="align-flex gray m-top30">
			<span class="red">*</span>选项（单选）
		</view>
		<radio-group class="m-top30" name="" @change="change">
			<view class="line align-flex textColor">
				<label>
					<radio :checked="result==1" color="#409eff" :value="1" /><text>同意</text>
				</label>
			</view>
			<view class="line align-flex textColor">
				<label>
					<radio :checked="result==-1" color="#409eff" :value="-1" /><text>不同意</text>
				</label>
			</view>
			
			<view class="line align-flex textColor">
				<label>
					<radio :checked="result==2" color="#409eff" :value="2" /><text>弃权</text>
				</label>
			</view>
		</radio-group>
		<view class="lbtn" @click="submit">提交</view>
	</view>
</template>

<script>
	export default {
		props: {
			temp: {
				default: {},
				
			}
		},
		data() {
			return {
				head: this.$head,
				result:1

			}
		},
		created() {
			
		},

		methods: {
			change(e){
				// console.log(e.detail.value)
				this.result=e.detail.value
			},
			submit() {
				var _this=this
				this.$showloading()
				this.$pop.ajaxPost("/busVote/poll/demand", {
					voteId:this.temp.id,
					result:this.result
				}).then(res => {
					uni.hideLoading()
					if(res.code==0){
						
						_this.$msg(res.msg)
						_this.$emit('submit')
					}else{
					this.$msg(res.msg)	
					}
				})
				
			},


		}
	}
</script>
